<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="/style/basic_layout.css" rel="stylesheet" type="text/css">
    <link href="/style/common_style.css" rel="stylesheet" type="text/css">
    <link href="/style/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="/js/jquery/jquery.js"></script>
    <script type="text/javascript" src="/js/plugins/artDialog/jquery.artDialog.js?skin=blue"></script>
    <script type="text/javascript" src="/js/plugins/fancyBox/jquery.mousewheel-3.0.6.pack.js"></script>
    <script type="text/javascript" src="/js/plugins/fancyBox/jquery.fancybox.js?v=2.1.5"></script>
    <script type="text/javascript" src="/js/plugins/artDialog/iframeTools.js"></script>
    <script type="text/javascript" src="/js/commonAll.js"></script>
    <script type="text/javascript">
        $(function () {
            //图片弹出层
            $(".fancybox").fancybox();
        })
    </script>
    <title>WMS-商品管理</title>
    <style>
        .alt td{ background:black !important;}
    </style>
</head>
<body>
<form id="searchForm" action="/product/list.do" method="post">
    <div id="container">
        <div class="ui_content">
            <div class="ui_text_indent">
                <div id="box_border">
                    <div id="box_top">搜索</div>
                    <div id="box_center">
                        商品名称/编码
                        <input type="text" class="ui_input_txt02" name="keyword" value=""/>
                        商品品牌
                        <select id="brandId" class="ui_select01" name="brandId">
                            <option value="-1">全部</option>
                            <c:forEach items="${brands}" var="ele">
                                <option value="${ele.id}">${ele.name}</option>
                            </c:forEach>
                        </select>

                        <script>
                            $("#brandId option[value='${qo.brandId}']").prop("selected",true);
                            $(function () {
                                $("#brandId").change(function () {
                                    $("input[name='currentPage']").val(1);
                                    $("#searchForm").submit();
                                });
                            })
                        </script>
                    </div>
                    <div id="box_bottom">
                        <input type="button" value="查询" class="ui_input_btn01 btn_check"/>
                    </div>
                    
                    <script>
                        $(".btn_check").click(function () {
                            $("input[name='currentPage']").val(1);
                            $("#searchForm").submit();
                        })
                    </script>
                </div>
            </div>
        </div>
        <div class="ui_content">
            <div class="ui_tb">
                <table class="table" cellspacing="0" cellpadding="0" width="100%" align="center" border="0">
                    <tr>
                        <th width="30"><input type="checkbox" id="all" /></th>
                        <th>编号</th>
                        <th>商品图片</th>
                        <th>商品名称</th>
                        <th>商品编码</th>
                        <th>商品品牌</th>
                        <th>成本价</th>
                        <th>零售价</th>
                        <th></th>
                    </tr>
                    <c:forEach items="${result.list}" var="list" varStatus="vs">
                        <tr>
                            <td><input type="checkbox" class="acb" /></td>
                            <td>${vs.count}</td>
                            <td>
                                <a class="fancybox" href="${list.imagePath}" data-fancybox-group="gallery"
                                    title="${list.name}">
                                    <img src="${list.smallImage}" class="list_img">
                                </a>
                            </td>
                            <td>${list.name}</td>
                            <td>${list.sn}</td>
                            <td>${list.brandName}</td>
                            <td>${list.costPrice}</td>
                            <td>${list.salePrice}</td>
                            <td>
                                <input class="left2right" type="button" value="选中"
                                       data-json='${list.jsonString}'>
                            </td>
                        </tr>
                    </c:forEach>
                    <script type="text/javascript">
                        $(function () {
                            //给选中按钮绑定点击事件
                            $(".left2right").click(function () {
                                var json = $(this).data("json");
                                //共享数据给父窗口.然后关闭自己
                                $.dialog.data("data",json);//共享数据,名称为data
                                $.dialog.close();
                            });
                        });
                    </script>
                </table>
            </div>
            <jsp:include page="/WEB-INF/views/common/page.jsp"/>
        </div>
    </div>
</form>
</body>
</html>